<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
    <title>ActionView::Digestor</title>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
    <link rel="stylesheet" href="../../css/reset.css" type="text/css" media="screen" />
<link rel="stylesheet" href="../../css/main.css" type="text/css" media="screen" />
<link rel="stylesheet" href="../../css/github.css" type="text/css" media="screen" />
<script src="../../js/jquery-1.3.2.min.js" type="text/javascript" charset="utf-8"></script>
<script src="../../js/jquery-effect.js" type="text/javascript" charset="utf-8"></script>
<script src="../../js/main.js" type="text/javascript" charset="utf-8"></script>
<script src="../../js/highlight.pack.js" type="text/javascript" charset="utf-8"></script>

</head>

<body>     
    <div class="banner">
        
            <span>Ruby on Rails v4.0.0</span><br />
        
        <h1>
            <span class="type">Class</span> 
            ActionView::Digestor 
            
                <span class="parent">&lt; 
                    
                    <a href="../Object.html">Object</a>
                    
                </span>
            
        </h1>
        <ul class="files">
            
            <li><a href="../../files/actionpack/lib/action_view/digestor_rb.html">actionpack/lib/action_view/digestor.rb</a></li>
            
        </ul>
    </div>
    <div id="bodyContent">
        <div id="content">
  


  


  
  


  


  
    <!-- Method ref -->
    <div class="sectiontitle">Methods</div>
    <dl class="methods">
      
        <dt>D</dt>
        <dd>
          <ul>
            
              
              <li>
                <a href="Digestor.html#method-i-dependencies">dependencies</a>,
              </li>
            
              
              <li>
                <a href="Digestor.html#method-c-digest">digest</a>,
              </li>
            
              
              <li>
                <a href="Digestor.html#method-i-digest">digest</a>
              </li>
            
          </ul>
        </dd>
      
        <dt>N</dt>
        <dd>
          <ul>
            
              
              <li>
                <a href="Digestor.html#method-i-nested_dependencies">nested_dependencies</a>,
              </li>
            
              
              <li>
                <a href="Digestor.html#method-c-new">new</a>
              </li>
            
          </ul>
        </dd>
      
    </dl>
  

  



  

    

    

    


    
      <!-- Section attributes -->
      <div class="sectiontitle">Attributes</div>
      <table border='0' cellpadding='5'>
        
          <tr valign='top'>
            <td class='attr-rw'>
              [R]
            </td>
            <td class='attr-name'>finder</td>
            <td class='attr-desc'></td>
          </tr>
        
          <tr valign='top'>
            <td class='attr-rw'>
              [R]
            </td>
            <td class='attr-name'>format</td>
            <td class='attr-desc'></td>
          </tr>
        
          <tr valign='top'>
            <td class='attr-rw'>
              [R]
            </td>
            <td class='attr-name'>name</td>
            <td class='attr-desc'></td>
          </tr>
        
          <tr valign='top'>
            <td class='attr-rw'>
              [R]
            </td>
            <td class='attr-name'>options</td>
            <td class='attr-desc'></td>
          </tr>
        
      </table>
    


    <!-- Methods -->
    
      <div class="sectiontitle">Class Public methods</div>
      
        <div class="method">
          <div class="title method-title" id="method-c-digest">
            
              <b>digest</b>(name, format, finder, options = {})
            
            <a href="Digestor.html#method-c-digest" name="method-c-digest" class="permalink">Link</a>
          </div>
          
          
            <div class="description">
              
            </div>
          
          
          
          
          
            
            <div class="sourcecode">
              
              <p class="source-link">
                Source: 
                <a href="javascript:toggleSource('method-c-digest_source')" id="l_method-c-digest_source">show</a>
                
                  | <a href="https://github.com/rails/rails/blob/faa2c71deef44ded8ef73513e63229d057552540/actionpack/lib/action_view/digestor.rb#L9" target="_blank" class="github_url">on GitHub</a>
                
              </p>
              <div id="method-c-digest_source" class="dyn-source">
                <pre><span class="ruby-comment"># File actionpack/lib/action_view/digestor.rb, line 9</span>
<span class="ruby-keyword">def</span> <span class="ruby-keyword ruby-title">self</span>.<span class="ruby-identifier">digest</span>(<span class="ruby-identifier">name</span>, <span class="ruby-identifier">format</span>, <span class="ruby-identifier">finder</span>, <span class="ruby-identifier">options</span> = {})
  <span class="ruby-identifier">cache_key</span> = [<span class="ruby-identifier">name</span>, <span class="ruby-identifier">format</span>] <span class="ruby-operator">+</span> <span class="ruby-constant">Array</span>.<span class="ruby-identifier">wrap</span>(<span class="ruby-identifier">options</span>[<span class="ruby-value">:dependencies</span>])
  <span class="ruby-identifier">@@cache</span>[<span class="ruby-identifier">cache_key</span>.<span class="ruby-identifier">join</span>(<span class="ruby-string">'.'</span>)] <span class="ruby-operator">||=</span> <span class="ruby-keyword">begin</span>
    <span class="ruby-identifier">klass</span> = <span class="ruby-identifier">options</span>[<span class="ruby-value">:partial</span>] <span class="ruby-operator">||</span> <span class="ruby-identifier">name</span>.<span class="ruby-identifier">include?</span>(<span class="ruby-string">&quot;/_&quot;</span>) <span class="ruby-operator">?</span> <span class="ruby-constant">PartialDigestor</span> <span class="ruby-operator">:</span> <span class="ruby-constant">Digestor</span>
    <span class="ruby-identifier">klass</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">name</span>, <span class="ruby-identifier">format</span>, <span class="ruby-identifier">finder</span>, <span class="ruby-identifier">options</span>).<span class="ruby-identifier">digest</span>
  <span class="ruby-keyword">end</span>
<span class="ruby-keyword">end</span></pre>
              </div>
            </div>
            
          </div>
        
        <div class="method">
          <div class="title method-title" id="method-c-new">
            
              <b>new</b>(name, format, finder, options={})
            
            <a href="Digestor.html#method-c-new" name="method-c-new" class="permalink">Link</a>
          </div>
          
          
            <div class="description">
              
            </div>
          
          
          
          
          
            
            <div class="sourcecode">
              
              <p class="source-link">
                Source: 
                <a href="javascript:toggleSource('method-c-new_source')" id="l_method-c-new_source">show</a>
                
                  | <a href="https://github.com/rails/rails/blob/faa2c71deef44ded8ef73513e63229d057552540/actionpack/lib/action_view/digestor.rb#L19" target="_blank" class="github_url">on GitHub</a>
                
              </p>
              <div id="method-c-new_source" class="dyn-source">
                <pre><span class="ruby-comment"># File actionpack/lib/action_view/digestor.rb, line 19</span>
<span class="ruby-keyword">def</span> <span class="ruby-keyword ruby-title">initialize</span>(<span class="ruby-identifier">name</span>, <span class="ruby-identifier">format</span>, <span class="ruby-identifier">finder</span>, <span class="ruby-identifier">options</span>={})
  <span class="ruby-ivar">@name</span>, <span class="ruby-ivar">@format</span>, <span class="ruby-ivar">@finder</span>, <span class="ruby-ivar">@options</span> = <span class="ruby-identifier">name</span>, <span class="ruby-identifier">format</span>, <span class="ruby-identifier">finder</span>, <span class="ruby-identifier">options</span>
<span class="ruby-keyword">end</span></pre>
              </div>
            </div>
            
          </div>
                  
      <div class="sectiontitle">Instance Public methods</div>
      
        <div class="method">
          <div class="title method-title" id="method-i-dependencies">
            
              <b>dependencies</b>()
            
            <a href="Digestor.html#method-i-dependencies" name="method-i-dependencies" class="permalink">Link</a>
          </div>
          
          
            <div class="description">
              
            </div>
          
          
          
          
          
            
            <div class="sourcecode">
              
              <p class="source-link">
                Source: 
                <a href="javascript:toggleSource('method-i-dependencies_source')" id="l_method-i-dependencies_source">show</a>
                
                  | <a href="https://github.com/rails/rails/blob/faa2c71deef44ded8ef73513e63229d057552540/actionpack/lib/action_view/digestor.rb#L32" target="_blank" class="github_url">on GitHub</a>
                
              </p>
              <div id="method-i-dependencies_source" class="dyn-source">
                <pre><span class="ruby-comment"># File actionpack/lib/action_view/digestor.rb, line 32</span>
<span class="ruby-keyword">def</span> <span class="ruby-keyword ruby-title">dependencies</span>
  <span class="ruby-constant">DependencyTracker</span>.<span class="ruby-identifier">find_dependencies</span>(<span class="ruby-identifier">name</span>, <span class="ruby-identifier">template</span>)
<span class="ruby-keyword">rescue</span> <span class="ruby-constant">ActionView</span><span class="ruby-operator">::</span><span class="ruby-constant">MissingTemplate</span>
  [] <span class="ruby-comment"># File doesn't exist, so no dependencies</span>
<span class="ruby-keyword">end</span></pre>
              </div>
            </div>
            
          </div>
        
        <div class="method">
          <div class="title method-title" id="method-i-digest">
            
              <b>digest</b>()
            
            <a href="Digestor.html#method-i-digest" name="method-i-digest" class="permalink">Link</a>
          </div>
          
          
            <div class="description">
              
            </div>
          
          
          
          
          
            
            <div class="sourcecode">
              
              <p class="source-link">
                Source: 
                <a href="javascript:toggleSource('method-i-digest_source')" id="l_method-i-digest_source">show</a>
                
                  | <a href="https://github.com/rails/rails/blob/faa2c71deef44ded8ef73513e63229d057552540/actionpack/lib/action_view/digestor.rb#L23" target="_blank" class="github_url">on GitHub</a>
                
              </p>
              <div id="method-i-digest_source" class="dyn-source">
                <pre><span class="ruby-comment"># File actionpack/lib/action_view/digestor.rb, line 23</span>
<span class="ruby-keyword">def</span> <span class="ruby-keyword ruby-title">digest</span>
  <span class="ruby-constant">Digest</span><span class="ruby-operator">::</span><span class="ruby-constant">MD5</span>.<span class="ruby-identifier">hexdigest</span>(<span class="ruby-node">&quot;#{source}-#{dependency_digest}&quot;</span>).<span class="ruby-identifier">tap</span> <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">digest</span><span class="ruby-operator">|</span>
    <span class="ruby-identifier">logger</span>.<span class="ruby-identifier">try</span> <span class="ruby-value">:info</span>, <span class="ruby-node">&quot;Cache digest for #{name}.#{format}: #{digest}&quot;</span>
  <span class="ruby-keyword">end</span>
<span class="ruby-keyword">rescue</span> <span class="ruby-constant">ActionView</span><span class="ruby-operator">::</span><span class="ruby-constant">MissingTemplate</span>
  <span class="ruby-identifier">logger</span>.<span class="ruby-identifier">try</span> <span class="ruby-value">:error</span>, <span class="ruby-node">&quot;Couldn't find template for digesting: #{name}.#{format}&quot;</span>
  <span class="ruby-string">''</span>
<span class="ruby-keyword">end</span></pre>
              </div>
            </div>
            
          </div>
        
        <div class="method">
          <div class="title method-title" id="method-i-nested_dependencies">
            
              <b>nested_dependencies</b>()
            
            <a href="Digestor.html#method-i-nested_dependencies" name="method-i-nested_dependencies" class="permalink">Link</a>
          </div>
          
          
            <div class="description">
              
            </div>
          
          
          
          
          
            
            <div class="sourcecode">
              
              <p class="source-link">
                Source: 
                <a href="javascript:toggleSource('method-i-nested_dependencies_source')" id="l_method-i-nested_dependencies_source">show</a>
                
                  | <a href="https://github.com/rails/rails/blob/faa2c71deef44ded8ef73513e63229d057552540/actionpack/lib/action_view/digestor.rb#L38" target="_blank" class="github_url">on GitHub</a>
                
              </p>
              <div id="method-i-nested_dependencies_source" class="dyn-source">
                <pre><span class="ruby-comment"># File actionpack/lib/action_view/digestor.rb, line 38</span>
<span class="ruby-keyword">def</span> <span class="ruby-keyword ruby-title">nested_dependencies</span>
  <span class="ruby-identifier">dependencies</span>.<span class="ruby-identifier">collect</span> <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">dependency</span><span class="ruby-operator">|</span>
    <span class="ruby-identifier">dependencies</span> = <span class="ruby-constant">PartialDigestor</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">dependency</span>, <span class="ruby-identifier">format</span>, <span class="ruby-identifier">finder</span>).<span class="ruby-identifier">nested_dependencies</span>
    <span class="ruby-identifier">dependencies</span>.<span class="ruby-identifier">any?</span> <span class="ruby-operator">?</span> { <span class="ruby-identifier">dependency</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-identifier">dependencies</span> } <span class="ruby-operator">:</span> <span class="ruby-identifier">dependency</span>
  <span class="ruby-keyword">end</span>
<span class="ruby-keyword">end</span></pre>
              </div>
            </div>
            
          </div>
                    </div>

    </div>
  </body>
</html>    